package object.library.operation;


import object.library.Book;
import object.library.BookList;

import java.util.Scanner;

public class AddOperation implements IOperation {
    @Override
    public void work(BookList bookList){
        System.out.println("新增图书");
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入书名：");
        String Name = scanner.next();
        System.out.println("请输入作者：");
        String Author = scanner.next();
        System.out.println("请输入价格：");
        double Price = scanner.nextDouble();
        System.out.println("请输入类别：");
        String type = scanner.next();
        Book book = new Book(Name, Author, Price, type);
        int size = bookList.getSize();
        bookList.setBook(size, book);
        bookList.setSize(size+1);
        System.out.println("图书添加成功！");

    }
}
